{include file='common/head.html'}

<div class="layui-body">
  {if([$list])}
  <div class="layui-tab layui-tab-brief" lay-filter="tab">
    <ul class="layui-tab-title">
      <li class="layui-this" lay-id="t1">幻灯片列表</li>
      <li lay-id="t2">幻灯片新增</li>
        {if(session('ucode')==10001)}
        <li lay-id="t3">分组管理</li>
        <li lay-id="t4">分组新增</li>
        {/if}
    </ul>
    <div class="layui-tab-content">
      <div class="layui-tab-item layui-show">
        <form action="{url./admin/Slide/mod}" method="post" class="layui-form" onkeydown="if(event.keyCode==13) return false;">
        <input type="hidden" name="formcheck" value="{$formcheck}" > 
        <table class="layui-table mt0">
              <thead>
                    <tr>
                      <th width="60">排序</th>
                        <th>分组名称</th>
                        <th>大图</th>
                        <th>缩略图</th>
                        <th>链接</th>
                        <th>标题</th>
                        <th>副标题</th>
                        <th>描述</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {foreach $slides(key,value)}
                    <tr>
                        <td class="table-input">
                        <input type="hidden" name="listall[]" value="[value->id]">
                        <input type="text" lay-ignore class="layui-input" name="sorting[]" value="[value->sorting]">
                        </td>
                        <td>分组[value->gid]-{fun=get_slidesort_name($value->gid)}</td>
                        <td><img src="{SITE_DIR}[value->pic]" style="height:30px;"></td>
                        <td><img src="{SITE_DIR}[value->ico]" style="height:30px;"></td>
                        <td>[value->link]</td>
                        <td>[value->title]</td>
                        <td>[value->subtitle]</td>
                        <td>[value->desc]</td>
                        <td>
                            {if($value->status)}
                            <a href="{url./admin/Slide/mod/id/'.$value->id.'/field/status/value/0}"><i class='fa fa-toggle-on' title="点击关闭"></i></a>
                            {else}
                            <a href="{url./admin/Slide/mod/id/'.$value->id.'/field/status/value/1}"><i class='fa fa-toggle-off' title="点击启用"></i></a>
                            {/if}
                        </td>
                        <td>
                            {fun=get_btn_mod($value->id)}
                            {fun=get_btn_del($value->id)}
                        </td>
                    </tr>
                    {/foreach}
                </tbody>
            </table>
            <button type="submit" name="submit" value="sorting" class="layui-btn layui-btn-sm">保存排序</button>
            </form> 
            <div class="page">{$pagebar}</div>
      </div>
      
      <div class="layui-tab-item">
        <form action="{url./admin/Slide/add}" method="post" class="layui-form">
          <input type="hidden" name="formcheck" value="{$formcheck}" > 
          <div class="layui-form-item">
                     <label class="layui-form-label">分组</label>
                     <div class="layui-input-block">
                      <select name="gid" >  
                        {foreach $gids(key,value)}
                            <option value="[value->id]">[value->name]</option>
                            {/foreach}
                    </select>
                     </div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">大图</label>
                     <div class="layui-input-inline">
                      <input type="text" name="pic" id="pic" required  lay-verify="required" placeholder="请上传大图"  class="layui-input">
                     </div>
                     <button type="button" class="layui-btn upload layui-btn-primary" data-des="pic">
                     <i class="layui-icon">&#xe67c;</i>上传图片
                    </button>
					<a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(1,'pic');"><i class="layui-icon">&#xe64a;</i>图库</a>
                    <div id="pic_box" class="pic"></div>
                </div>

                <div class="layui-form-item">
                     <label class="layui-form-label">缩略图</label>
                     <div class="layui-input-inline">
                      <input type="text" name="ico" id="ico" placeholder="请上传缩略图"  class="layui-input">
                     </div>
                     <button type="button" class="layui-btn upload layui-btn-primary" data-des="ico">
                     <i class="layui-icon">&#xe67c;</i>上传图片
                    </button>
					<a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(1,'ico');"><i class="layui-icon">&#xe64a;</i>图库</a>
                    <div id="ico_box" class="pic"></div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">链接</label>
                     <div class="layui-input-block">
                      <input type="text" name="link" placeholder="请输入跳转链接"  class="layui-input">
                     </div>
                </div>
                
                 <div class="layui-form-item">
                     <label class="layui-form-label">标题</label>
                     <div class="layui-input-block">
                      <input type="text" name="title" placeholder="请输入标题"  class="layui-input">
                     </div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">副标题</label>
                     <div class="layui-input-block">
                      <input type="text" name="subtitle" placeholder="请输入副标题"  class="layui-input">
                     </div>
                </div>

                <div class="layui-form-item">
                     <label class="layui-form-label">描述</label>
                     <div class="layui-input-block">
                        <textarea name="desc" id="" placeholder="请输入描述" class="layui-textarea"></textarea>
                     </div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">排序</label>
                     <div class="layui-input-block">
                      <input type="text" name="sorting" required lay-verify="required" value="255" placeholder="请输入排序"  class="layui-input">
                     </div>
                </div>

                <div class="layui-form-item">
                     <label class="layui-form-label">状态</label>
                     <div class="layui-input-block">
                            <input type="radio" name="status" value="1" title="启用" checked>
                            <input type="radio" name="status" value="0" title="关闭">
                        </div>
                </div>
                
                 <div class="layui-form-item">
           <div class="layui-input-block">
              <button class="layui-btn" lay-submit>立即提交</button>
              <!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
           </div>
        </div>
        </form>
      </div>

        {if(session('ucode')==10001)}
        <div class="layui-tab-item">
            <form action="{url./admin/Slide/submod}" method="post" class="layui-form" onkeydown="if(event.keyCode==13) return false;">
                <input type="hidden" name="formcheck" value="{$formcheck}">
                <table class="layui-table center-table">
                    <thead>
                        <tr>
                            <th width="60">排序</th>
                            <th width="60">ID</th>
                            <th>分组名</th>
                            <th>备注</th>
                            <!-- <th>状态</th> -->
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {foreach $sorts(key,value)}
                        <tr>
                            <td class="table-input">
                                <input type="hidden" name="listall[]" value="[value->id]">
                                <input type="text" lay-ignore class="layui-input" name="sorting[]" value="[value->sorting]">
                            </td>
                            <td nowrap="nowrap">[value->id]</td>
                            <td>[value->name]</td>
                            <td>[value->note]</td>
                            <!-- <td>
                                {if($value->status)}
                                <a href="{url./admin/Slide/submod/id/'.$value->id.'/field/status/value/0}"><i class='fa fa-toggle-on' title="点击关闭"></i></a>
                                {else}
                                <a href="{url./admin/Slide/submod/id/'.$value->id.'/field/status/value/1}"><i class='fa fa-toggle-off' title="点击启用"></i></a>
                                {/if}
                            </td> -->
                            <td>
                                {fun=get_btn('修改','','submod',$value->id)}
                                <a href='javascript:confirm_delete("{url./admin/Slide/subdel/id/'.$value->id.'}")' class="layui-btn layui-btn-xs layui-btn-danger" style="margin-bottom:0px" title="删除">删除</a>
                            </td>
                        </tr>
                        {/foreach}
                    </tbody>
                </table>
                <button type="submit" name="submit" value="sorting" class="layui-btn layui-btn-sm">保存排序</button>
            </form>
        </div>
        <div class="layui-tab-item">
            <form action="{url./admin/Slide/addsort}" method="post" class="layui-form js-tab-form" lay-filter="sort">
                <input type="hidden" name="formcheck" value="{$formcheck}">
                <div class="layui-form-item">
                    <label class="layui-form-label">名称 <span class="layui-text-red">*</span></label>
                    <div class="layui-input-block">
                        <input type="text" name="name" required lay-verify="required" placeholder="请输入轮播组名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注信息 <span class="layui-text-red">*</span></label>
                    <div class="layui-input-block">
                        <textarea name="note" id="" placeholder="请输入备注信息" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="layui-form-item" style="display: none;">
                     <label class="layui-form-label">状态</label>
                     <div class="layui-input-block">
                            <input type="radio" name="status" value="1" title="启用" checked>
                            <input type="radio" name="status" value="0" title="关闭">
                        </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit>立即提交</button>
                        <!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
                    </div>
                </div>
            </form>
        </div>
        {/if}
    </div>
  </div>
  {/if} 
  
  {if([$mod])}
  <div class="layui-tab layui-tab-brief" lay-filter="tab">
    <ul class="layui-tab-title">
      <li class="layui-this">幻灯片修改</li>
    </ul>
    <div class="layui-tab-content">
      <div class="layui-tab-item layui-show">
        <form action="{url./admin/Slide/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form">
          <input type="hidden" name="formcheck" value="{$formcheck}" > 
          <div class="layui-form-item">
                     <label class="layui-form-label">分组</label>
                     <div class="layui-input-block">
                      <select name="gid"> 
                      {foreach $gids(key,value)}
                            <option value="[value->id]" {if([$slide->gid]==$value->id)}selected{/if}>[value->name]</option>
                            {/foreach}
                    </select>
                     </div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">图片</label>
                     <div class="layui-input-inline">
                      <input type="text" name="pic" id="pic" required  lay-verify="required" value="{$slide->pic}" placeholder="请上传图片"  class="layui-input">
                     </div>
                     <button type="button" class="layui-btn upload layui-btn-primary" data-des="pic">
                       <i class="layui-icon">&#xe67c;</i>上传图片
                     </button>
					 <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(1,'pic');"><i class="layui-icon">&#xe64a;</i>图库</a>
                     <div id="pic_box" class="pic">{if([$slide->pic])}<dl><dt><img src="{SITE_DIR}{$slide->pic}" data-url="{$slide->pic}"></dt><dd>删除</dd></dl>{/if}</div>
                </div>

                <div class="layui-form-item">
                     <label class="layui-form-label">缩略图</label>
                     <div class="layui-input-inline">
                        <input type="text" name="ico" id="ico" value="{$slide->ico}" placeholder="请上传缩略图"  class="layui-input">
                     </div>
                     <button type="button" class="layui-btn upload" data-des="ico">
                         <i class="layui-icon">&#xe67c;</i>上传图片
                     </button>
					 <a class="layui-btn layui-btn-warm" onclick="GetPictureFolder(1,'ico');"><i class="layui-icon">&#xe64a;</i>图库</a>
                     <div id="ico_box" class="pic">{if([$slide->ico])}<dl><dt><img src="{SITE_DIR}{$slide->ico}" data-url="{$slide->ico}"></dt><dd>删除</dd></dl>{/if}</div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">跳转链接</label>
                     <div class="layui-input-block">
                      <input type="text" name="link" value="{$slide->link}"  placeholder="请输入跳转链接"  class="layui-input">
                     </div>
                </div>
                
                <div class="layui-form-item">
                     <label class="layui-form-label">标题</label>
                     <div class="layui-input-block">
                      <input type="text" name="title" value="{$slide->title}" placeholder="请输入标题"  class="layui-input">
                     </div>
                </div>
                
                 <div class="layui-form-item">
                     <label class="layui-form-label">副标题</label>
                     <div class="layui-input-block">
                      <input type="text" name="subtitle" value="{$slide->subtitle}" placeholder="请输入副标题"  class="layui-input">
                     </div>
                </div>

                <div class="layui-form-item">
                     <label class="layui-form-label">描述</label>
                     <div class="layui-input-block">
                        <textarea name="desc" placeholder="请输入描述" class="layui-textarea">{$slide->desc}</textarea>
                     </div>
                </div>
                
                 <div class="layui-form-item">
                     <label class="layui-form-label">排序</label>
                     <div class="layui-input-block">
                      <input type="text" name="sorting" required lay-verify="required" value="{$slide->sorting}" placeholder="请输入排序"  class="layui-input">
                     </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" value="1" title="显示" {if([$slide->status]==1)}checked="checked"{/if}>
                        <input type="radio" name="status" value="0" title="隐藏" {if([$slide->status]==0)}checked="checked"{/if}>
                    </div>
                </div>
                
                 <div class="layui-form-item">
           <div class="layui-input-block">
              <button class="layui-btn" lay-submit>立即提交</button>
              <!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->
              {fun=get_btn_back()}
           </div>
        </div>
        </form>
      </div>
    </div>
  </div>
  {/if} 

    {if([$submod])}
    <div class="layui-tab layui-tab-brief" lay-filter="tab">
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form action="{url./admin/Slide/submod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form js-tab-form" lay-filter="sort">
                    <input type="hidden" name="formcheck" value="{$formcheck}">
                    <div class="layui-tab">
                        <ul class="layui-tab-title">
                            <li class="layui-this">编辑轮播组</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">名称 <span class="layui-text-red">*</span></label>
                                    <div class="layui-input-block">
                                        <input type="text" name="name" required lay-verify="required" value="{$sort->name}" placeholder="请输入轮播组名称" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">备注信息 <span class="layui-text-red">*</span></label>
                                    <div class="layui-input-block">
                                        <textarea name="note" id="" placeholder="请输入备注信息" class="layui-textarea">{$sort->note}</textarea>
                                    </div>
                                </div>
                                <div class="layui-form-item" style="display: none;">
                                    <label class="layui-form-label">状态</label>
                                    <div class="layui-input-block">
                                        <input type="radio" name="status" value="1" title="显示" {if([$sort->status]==1)}checked="checked"{/if}>
                                        <input type="radio" name="status" value="0" title="隐藏" {if([$sort->status]==0)}checked="checked"{/if}>
                                    </div>
                                </div>
                                 <div class="layui-form-item">
                                     <label class="layui-form-label">排序</label>
                                     <div class="layui-input-block">
                                        <input type="text" name="sorting" required lay-verify="required" value="{$sort->sorting}" placeholder="请输入排序"  class="layui-input">
                                     </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit>立即提交</button>
                            <a href="javascript:void(history.back())" class="layui-btn layui-btn-primary">返 回</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    {/if}

</div>
{include file='common/foot.html'}
